import { setAppInfo } from '@/utils/auth'

export function appColor(getAppInfo) {
  // console.log(process.env.VERSION)
  // console.log(getAppInfo.appVersion)
  if (getAppInfo.appVersion) {
    let versionNo = String(getAppInfo.appVersion).split('')
    getAppInfo.appVersion = versionNo.join('.')
  }
  if (getAppInfo.style) {
    let style = {}
    switch (getAppInfo.style.styleType) {
      default:
      case 10:
        style.color1 = ''
        style.color2 = '#ffe100'
        style.color3 = ''
        style.color4 = '#333333'
        style.color5 = '#333333'
        style.color6 = '#ffe100'
        style.color7 = '#333333'
        style.color8 = '#ffe100'
        style.text = '#333333'
        style.styleName = '风格一'
        break
      case 11:
        style.color1 = '#0fa0fe'
        style.color2 = '#1e77f5'
        style.color3 = ''
        style.color4 = '#1a98fc'
        style.color5 = '#ffffff'
        style.color6 = '#1e77f5'
        style.color7 = '#1a98fc'
        style.color8 = '#ffffff'
        style.text = '#ffffff'
        style.styleName = '风格二'
        break
      case 12:
        style.color1 = '#63df70'
        style.color2 = '#1ebb1c'
        style.color3 = ''
        style.color4 = '#333333'
        style.color5 = '#ffffff'
        style.color6 = '#1ebb1c'
        style.color7 = '#333333'
        style.color8 = '#1ebb1c'
        style.text = '#ffffff'
        style.styleName = '风格三'
        break
      case 13:
        style.color1 = '#f5cc93'
        style.color2 = '#daac6f'
        style.color3 = ''
        style.color4 = '#f6e9d8'
        style.color5 = '#ffffff'
        style.color6 = '#daac6f'
        style.color7 = '#f6e9d8'
        style.color8 = '#daac6f'
        style.text = '#ffffff'
        style.styleName = '风格四'
        break
      case 14:
        style.color1 = '#ffa201'
        style.color2 = '#ff7024'
        style.color3 = '#ffd247'
        style.color4 = '#ffa235'
        style.color5 = '#ffffff'
        style.color6 = '#ff7024'
        style.color7 = '#ffa235'
        style.color8 = '#ffffff'
        style.text = '#ffffff'
        style.styleName = '风格五'
        break
      case 15:
        style.color1 = '#ff3a50'
        style.color2 = '#ff243e'
        style.color3 = ''
        style.color4 = '#333333'
        style.color5 = '#ffffff'
        style.color6 = '#ff243d'
        style.color7 = '#fefbb0'
        style.color8 = '#ff243e'
        style.text = '#ffffff'
        style.styleName = '风格六'
        break
    }
    style.styleType = getAppInfo.style.styleType
    getAppInfo.style = style
  }
  setAppInfo(getAppInfo)
  return getAppInfo
}
